﻿using System.Xml;

namespace LBSoft.Common.DotNetExt
{
    public static class ExtXMLNode
    {
        /// <summary>
        /// 获取XML节点一个属性的属性值 若不存在返回String.Empty
        /// </summary>
        /// <param name="source">XML节点</param>
        /// <param name="attributeName">属性名</param>
        /// <returns>属性名</returns>
        public static string GetAttributeValue(this XmlNode source, string attributeName)
        {
            if(source.Attributes[attributeName]==null)
            {
                return string.Empty;
            }
            else
            {
                return source.Attributes[attributeName].Value;
            }
        }
    }
}
